/*
 * @Author: 李小晴 2689279066@qq.com
 * @Date: 2022-06-09 09:32:15
 * @LastEditors: 李小晴 2689279066@qq.com
 * @LastEditTime: 2022-06-15 09:01:29
 * @FilePath: \admin\src\api\admin\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useAxios } from '@/hooks/web/useAxios'

const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
export const dictApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'dict',
      data: data
    }
  })
}

export const dictRelsApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'dictRels',
      data: data
    }
  })
}

export const adminDictTypeListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictTypeList',
      data: data
    }
  })
}
export const adminDictTypeAddApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictTypeAdd',
      data: data
    }
  })
}
export const adminDictTypeEditApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictTypeEdit',
      data: data
    }
  })
}
export const adminDictTypeSeeApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictTypeSee',
      data: data
    }
  })
}

export const adminDictDataListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictDataList',
      data: data
    }
  })
}

export const adminDictDataAddApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictDataAdd',
      data: data
    }
  })
}

export const adminDictDataEditApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictDataEdit',
      data: data
    }
  })
}

// 字典联动
export const adminDictRelsListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDictRelsList',
      data: data
    }
  })
}

export const adminRelsAddApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminRelsAdd',
      data: data
    }
  })
}

export const adminRelsEditApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminRelsEdit',
      data: data
    }
  })
}
